package com.nuanqian.springbootdubboserver.service.impl;

import com.alibaba.dubbo.config.annotation.Service;

import com.nuanqian.springbootdubboapi.service.TestService;
import com.nuanqian.springbootdubboentity.entity.User;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 具体实现
 * @author 李蒙
 * @date 2020/6/17 15:20
 */
@Service(version = "1.0.0",timeout = 10000,group = "1") // version 版本 ， timeout :服务端会话session超时时间 ，group ：当一个接口有多种实现时可以用 group 区分
public class TestServiceImpl implements TestService {
    @Override
    public String sayHello(String str) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return dateFormat.format(new Date()) + ": " + str;
    }

    @Override
    public User findUser() {
//        try {
//            Thread.sleep(8000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        User user = new User();
        user.setId(1001);
        user.setUsername("scott");
        user.setPassword("tiger");
        user.setAge(20);
        user.setGender(0);
        return user;
    }
}
